package lab02.test23;

import java.util.Date;
import java.io.*;
import java.util.*;

/**
 * Created by dell on 2017/11/1.
 */
public class Test23 {
    //23、 	编写Java应用程序，从命令行输入你的生日信息，
    // 然后计算你的生日还有多少天，你的生日是星期几。
    public static void main(String[] args) {

        Calendar calendar = Calendar.getInstance();//创建一个日历
        int sum = 0;
        String date = "1997,07,01";
        int year = 0;
        int month = 0;
        int day = 0;

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("请输入年、月、日：");

    public void setDate(int year, int month, int day){
        calender.set(year, month - 1, day);
    }

    //获取该日是一年当中的第几天
    public int getDay() {
        return calender.get(6);
    }

    //获取该日是星期几
    public String getDate() {
        int date = calender.get(7);
        return getWeekday(date);
    }

    //判断解析一周7天的值
    public String getWeekday(int dayofweek) {
        switch (dayofweek) {
            case 1:
                return "星期日";
            case 2:
                return "星期一";
            case 3:
                return "星期二";
            case 4:
                return "星期三";
            case 5:
                return "星期四";
            case 6:
                return "星期五";
            case 7:
                return "星期六";
            default:
                return "error";
        }
    }

}

